# Maintainer: Raphael Amorim <rapha850@gmail.com>
_realname=rio
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.2.16
pkgrel=1
pkgdesc="A hardware-accelerated GPU terminal emulator focusing to run in desktops and browsers (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/raphamorim/rio"
license=('spdx:MIT')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
makedepends=("${MINGW_PACKAGE_PREFIX}-rust")
source=("https://github.com/raphamorim/${_realname}/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('0645113a1677d4a15320b1a8705abd905ab05286113f44b3eada9a142849de20')

prepare() {
  cd "${_realname}-${pkgver}"

  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
  cd "${_realname}-${pkgver}"

  cargo build -p rioterm --release --frozen
}

check() {
  cd "${_realname}-${pkgver}"

  cargo test -p rioterm --release --frozen
}

package() {
  cd "${_realname}-${pkgver}"

  cargo install \
    --offline \
    --no-track \
    --frozen \
    --path frontends/rioterm \
    --root "${pkgdir}${MINGW_PREFIX}"
}
